// JavaScript Document
var timeout         = 500;
var closetimer		= 0;
var ddmenuitem      = 0;

function gnb_open()
{	gnb_canceltimer();
	gnb_close();
	ddmenuitem = $(this).find('ul').eq(0).css('display', 'block');}

function gnb_close()
{	if(ddmenuitem) ddmenuitem.css('display', 'none');}

function gnb_timer()
{	closetimer = window.setTimeout(gnb_close, timeout);}

function gnb_canceltimer()
{	if(closetimer)
	{	window.clearTimeout(closetimer);
		closetimer = null;}}

$(document).ready(function()
{	$('#gnb > li').bind('mouseover', gnb_open);
	$('#gnb > li').bind('mouseout',  gnb_timer);});

document.onclick = gnb_close;